extends Area2D

@export var mouse_over = false
@export var id = 0
@export var rowcol_id = 0
@export var visited = false
@export var zoom = 1.2
@export var avaliable = true
@onready var animation = $AnimatedSprite2D

func _ready() -> void:
	animation.frame = 0
	
func _on_mouse_entered() -> void:
	mouse_over = true

func _on_mouse_exited() -> void:
	mouse_over = false

func _on_input_event(viewport, event, shape_idx) -> void:
	if avaliable :
		if event is InputEventMouseButton and mouse_over :
			if event.pressed and event.button_index == MOUSE_BUTTON_LEFT :
				visited = true
				get_parent().current_node = id
				get_parent().queue_redraw()
				#Manager.pause_scene(get_parent())

func _process(delta: float) -> void:
	scale = Vector2(1.0,1.0)
	if avaliable :
		animation.frame = 1
		if mouse_over : scale = Vector2(zoom,zoom)
	else :
		if visited : animation.frame = 2
		else : animation.frame = 0
